export async function downLoadFromInternet(url: string, fileName?: string) {
  const _filename = fileName ?? (url.split('/').pop() as string);
  const fetchRes = await fetch(url);
  const blob = await fetchRes.blob();
  if (blob) {
    const dataUrl = window.URL.createObjectURL(blob);
    // 创建一个虚拟的下载链接元素
    const link = document.createElement('a');
    link.href = window.URL.createObjectURL(blob);
    link.download = _filename;

    // 模拟点击下载链接以触发下载
    link.click();

    // 清理临时的下载链接
    window.URL.revokeObjectURL(dataUrl);
  }
}
